package cloud.estate.letter.controller;

import cloud.estate.commons.bean.Letter;
import cloud.estate.commons.util.JsonResult;
import cloud.estate.letter.service.letterService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/letter")
public class letterController {
    @Resource
    private letterService letterService;
    @PostMapping("/addOneLetter")
    public JsonResult addOneLetter(Letter letter){
        return letterService.addOneLetter(letter);
    }
    @PostMapping("/deleteOneLetter")
    public JsonResult deleteOneLetter(String id){
        return letterService.deleteOneLetter(id);
    }
    @PostMapping("/updateOneLetter")
    public JsonResult updateOneLetter(Letter letter){
        return letterService.updateOneLetter(letter);
    }
    @GetMapping("/getOneLetter")
    public JsonResult getOneLetter(String id){
        return letterService.getOneLetter(id);
    }
    @GetMapping("/listAllLetter")
    public JsonResult listAllLetter(){
        return letterService.listAllLetter();
    }
}
